package com.wisdom;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;

import com.slidingmenu.lib.SlidingMenu;
import com.slidingmenu.lib.app.SlidingFragmentActivity;


public class BaseActivity extends SlidingFragmentActivity
{

    protected Fragment    mFrag;

    protected SlidingMenu slidingMenu;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        setBehindContentView(R.layout.menu_frame);
        FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
        mFrag = new MenuFragment();
        t.replace(R.id.menu_frame, mFrag);
        t.commit();
/*
        slidingMenu = getSlidingMenu();
        slidingMenu.setMode(SlidingMenu.LEFT_RIGHT);
        slidingMenu.setShadowWidth(getWindowManager().getDefaultDisplay().getWidth() / 40);
        slidingMenu.setShadowDrawable(R.drawable.shadow);
        slidingMenu.setSecondaryShadowDrawable(R.drawable.right_shadow);
        slidingMenu.setBehindOffset(getWindowManager().getDefaultDisplay().getWidth() / 5);
        slidingMenu.setFadeEnabled(true);
        slidingMenu.setFadeDegree(0.4f);
        slidingMenu.setBehindScrollScale(0);
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
 */       
      slidingMenu = getSlidingMenu();
      //设置是左滑还是右滑，还是左右都可以滑
      slidingMenu.setMode(SlidingMenu.LEFT_RIGHT);
      //设置阴影宽度
      slidingMenu.setShadowWidth(getWindowManager().getDefaultDisplay().getWidth() / 40);
      //设置左菜单阴影图片
      slidingMenu.setShadowDrawable(R.drawable.shadow);
      //设置右菜单阴影图片
      slidingMenu.setSecondaryShadowDrawable(R.drawable.right_shadow);
      //设置菜单占屏幕的比例
      slidingMenu.setBehindOffset(getWindowManager().getDefaultDisplay().getWidth() / 3);
      //设置滑动时菜单的是否淡入淡出
      slidingMenu.setFadeEnabled(true);
      //设置淡入淡出的比例
      slidingMenu.setFadeDegree(0.4f);
      //设置滑动时拖拽效果
      slidingMenu.setBehindScrollScale(0);
      //设置要使菜单滑动，触碰屏幕的范围
      slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    }

}
